//
//  WLG_HomePageViewController.m
//  MooMusic
//
//  Created by wjy on 15/10/19.
//  Copyright © 2015年 wjy. All rights reserved.
//

#import "WLG_HomePageViewController.h"
#import "WJY_SongRankCell.h"
#import "WJY_HomeScondCell.h"
#import "WJY_HotCollectionCell.h"
#import "WJY_FilmeSongTableViewCell.h"
#import "WJY_TenSongEveryDayCell.h"
#import <UIButton+WebCache.h>
//#import "WJY_HomeScondCell.h"
#import "HomeModel.h"
// 导入影视金曲controller的头文件
#import "LTY_FilmAndSongsViewController.h"
// 导入搜索头文件
#import "LTY_SearchViewController.h"
// 导入WKWebView的头文件
#import "LTY_WKWebViewController.h"
// 导入webview的头文件
#import "LTY_WebViewController.h"
// 导入歌单广场头文件
#import "GCW_SongMuneViewController.h"

// 导入音乐专题头文件
#import "LTY_MusicProjectViewController.h"

/* 导入button模块的头文件*/
#import "GCW_RankViewController.h"
#import "GCW_SingerViewController.h"
#import "GCW_VideoViewController.h"
#import "GCW_SongMuneViewController.h"
#import "GCW_MineViewController.h"

static NSString *const cellInderfier = @"cellInderfier";

@interface WLG_HomePageViewController ()<UITableViewDataSource, UITableViewDelegate>
{
    UITableView *_homeTableView;
    UIView *_topView;
    UIButton *_rankBut;
    UIButton *_songMenuBut;
    UIButton *_videoBut;
    UIButton *_singerBut;
    UIView *_scrollImg;

}
@property (nonatomic, strong) NSMutableArray *homeTitleArr;
@property (nonatomic, strong) NSMutableArray *topScrollPicArr;
@property (nonatomic, strong) NSMutableArray *buttonArr;
@property (nonatomic, strong) NSMutableArray *firstRowArr;
@property (nonatomic, strong) NSMutableArray *scondRowArr;
@property (nonatomic, strong) NSMutableArray *asiaRowArr;
@property (nonatomic, strong) NSMutableArray *eveyTenRowArr;
@property (nonatomic, strong) NSMutableArray *musicRowArr;
@property (nonatomic, strong) NSMutableArray *musicValArr;
@property (nonatomic, strong) TabBarController *tabBarSingle;
@end

@implementation WLG_HomePageViewController
// 初始化消息通知
- (instancetype)init
{
    self = [super init];
    if (self) {
        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(pushSucess:) name:@"pushNextVC" object:nil];
    }
    return self;
}
#pragma mark -- 消息触发的方法
- (void)pushSucess:(NSNotification *)postSender
{
    LTY_FilmAndSongsViewController *FilmAndSongsVC = [[LTY_FilmAndSongsViewController alloc] init];
    NSMutableDictionary *Dic = [postSender object];
    NSString *string = [Dic objectForKey:@"A"];
    NSString *nameString = [Dic objectForKey:@"B"];
    NSString *descString = [Dic objectForKey:@"C"];
    NSString *stringUrl = [NSString stringWithFormat:HotSongString, string];
    FilmAndSongsVC.DayString = stringUrl;
    FilmAndSongsVC.nameString = nameString;
    FilmAndSongsVC.descString = descString;
        
    [self.navigationController pushViewController:FilmAndSongsVC animated:YES];
}

#pragma mark -- 搜索按钮触发的方法
- (void)searchAction
{
    NSLog(@"搜索按钮触发的方法");
    LTY_SearchViewController *searchVC = [[LTY_SearchViewController alloc] init];
    [self.navigationController pushViewController:searchVC animated:YES];
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    
    [self.navigationController.navigationBar setBarTintColor:COLOR(22, 88, 240, 1.0)];
    self.navigationController.navigationBar.translucent = NO;
    self.view.backgroundColor = [UIColor lightGrayColor];
    
    // 设置搜索按钮
    UIImage *searchImage = [UIImage imageNamed:@"iconfont-search.png"];
    // 取消渲染
    searchImage = [searchImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:searchImage style:UIBarButtonItemStylePlain target:self action:@selector(searchAction)];
    
    
    
    
    // 设置左边的抽屉
    // 图片
    UIImage *boxImage = [UIImage imageNamed:@"btn_nav_list@2x.png"];
    // 取消渲染
    boxImage = [boxImage imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    // 有警告没有关系!!!
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithImage:boxImage style:UIBarButtonItemStylePlain target:self action:@selector(presentLeftMenuViewController:)];
    self.tabBarSingle = [TabBarController shareTabBar];
    
    [self createView];
    [self getData];
    
    // 夜间模式
    if ([NightMode shareNightMode].isNight) {
        [[NightMode shareNightMode] loadNightModeInfoFormDisk];
    }

    
}
- (instancetype)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        self.homeTitleArr = [NSMutableArray array];
        self.topScrollPicArr = [NSMutableArray array];
        self.asiaRowArr = [NSMutableArray array];
        self.eveyTenRowArr = [NSMutableArray array];
        self.musicRowArr = [NSMutableArray array];
        _buttonArr = [NSMutableArray array];
        self.musicValArr = [NSMutableArray array];
       
    }
    return self;
}
- (void)createView
{
    _homeTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, SCREENHEIGHT - TOPHEIGHT - BOTTOMHEIGHT ) style:UITableViewStylePlain];
    _homeTableView.delegate = self;
    _homeTableView.dataSource = self;
    [_homeTableView registerClass:[WJY_HomeScondCell class] forCellReuseIdentifier:@"firstCell"];
    [_homeTableView registerClass:[WJY_TenSongEveryDayCell class] forCellReuseIdentifier:@"tenCell"];
    [_homeTableView registerClass:[WJY_SongRankCell class] forCellReuseIdentifier:@"rankCell"];
     [_homeTableView registerClass:[WJY_SongRankCell class] forCellReuseIdentifier:@"asiaCell"];
    [_homeTableView registerClass:[WJY_FilmeSongTableViewCell class] forCellReuseIdentifier:@"filmCell"];
   
    _topView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 200)];
//    _topView.backgroundColor = [UIColor lightGrayColor];
    
    _scrollImg = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 150)];
    [_topView addSubview:_scrollImg];
    [self.view addSubview:_homeTableView];
    _rankBut = [UIButton buttonWithType:UIButtonTypeCustom];
//    _rankBut.backgroundColor = [UIColor cyanColor];
   
    
    _rankBut.tag = 1001;
    [_rankBut addTarget:self action:@selector(butAction:) forControlEvents:UIControlEventTouchUpInside];
    [_topView addSubview:_rankBut];
    _songMenuBut = [UIButton buttonWithType:UIButtonTypeCustom];
//    _songMenuBut.backgroundColor = [UIColor lightGrayColor];
    _songMenuBut.tag = 1002;
    [_songMenuBut addTarget:self action:@selector(butAction:) forControlEvents:UIControlEventTouchUpInside];
    [_topView addSubview:_songMenuBut];
    _videoBut = [UIButton buttonWithType:UIButtonTypeCustom];
//    _videoBut.backgroundColor = [UIColor yellowColor];
    _videoBut.tag = 1003;
    [_videoBut addTarget:self action:@selector(butAction:) forControlEvents:UIControlEventTouchUpInside];
    [_topView addSubview:_videoBut];
    _singerBut = [UIButton buttonWithType:UIButtonTypeCustom];
//    _singerBut.backgroundColor = [UIColor blueColor];
    _singerBut.tag = 1004;
    [_singerBut addTarget:self action:@selector(butAction:) forControlEvents:UIControlEventTouchUpInside];
    [_topView addSubview:_singerBut];
    _rankBut.frame = CGRectMake((SCREENWIDTH - 160) / 5, _scrollImg.frame.size.height + 5, 50, 50);
    _songMenuBut.frame = CGRectMake(_rankBut.frame.origin.x + 40 + (SCREENWIDTH - 160) / 5, _scrollImg.frame.size.height + 5, 50, 50);
    _videoBut.frame = CGRectMake(40 + _songMenuBut.frame.origin.x +(SCREENWIDTH - 160) / 5  , _scrollImg.frame.size.height + 5, 50, 50);
    _singerBut.frame = CGRectMake(40 +_videoBut.frame.origin.x + (SCREENWIDTH - 160) / 5 , _scrollImg.frame.size.height + 5, 50, 50);
    
    _homeTableView.tableHeaderView = _topView;
    
    
}
- (void)butAction:(UIButton *)sender
{
    if (sender.tag == 1001) {
        GCW_RankViewController *rank = [[GCW_RankViewController alloc]init];
//
//        GCW_MineViewController *mine = [[GCW_MineViewController alloc]init];
        [self.navigationController pushViewController:rank  animated:YES];
    } else if (sender.tag == 1002){
        
        GCW_SongMuneViewController *songMune = [[GCW_SongMuneViewController alloc]init];
        [self.navigationController pushViewController:songMune animated:YES];
    
    }else if (sender.tag == 1003){
        
        GCW_VideoViewController *video = [[GCW_VideoViewController alloc]init];
        [self.navigationController pushViewController:video animated:YES];
        
    }else if (sender.tag == 1004){
        
        GCW_SingerViewController *singer = [[GCW_SingerViewController alloc]init];
        [self.navigationController pushViewController:singer animated:YES];
    }
}
- (void)getData
{
    


        


    [NetWork networkGETRequesWithURL:HomeUrl Paramater:nil pageUniquenessIdentifier:@"HomePageString" result:^(id result) {
        
        
//    }];
//    
//    
//    
//    [NetWork networkGETRequestWithURL:HomeUrl Paramater:nil ResultBlock:^(id result) {

        for (NSDictionary *dic in result[@"data"]) {
            [self.homeTitleArr addObject:dic[@"name"]];
        }
        for (NSDictionary *dic in [result objectForKey:@"data"][0][@"data"]) {
            [self.topScrollPicArr addObject:dic[@"picUrl"]];
        }
        self.asiaRowArr = [HomeModel arrayWithModelByArray:result[@"data"][6][@"data"]];
        self.eveyTenRowArr = [HomeModel arrayWithModelByArray:result[@"data"][9][@"data"]];
        self.musicRowArr = [HomeModel arrayWithModelByArray:result[@"data"][10][@"data"]];
        self.firstRowArr = [HomeModel arrayWithModelByArray:result[@"data"][3][@"data"]];
        for (NSDictionary *dic in result[@"data"][10][@"data"]) {
            [self.musicValArr addObject:dic[@"action"][@"value"]];
        }
//        NSLog(@"~~~~~~~+++++++++value%@", self.musicValArr);
        _buttonArr = [HomeModel arrayWithModelByArray:result[@"data"][1][@"data"]];
        if (self.homeTitleArr > 0) {
            [_homeTableView reloadData];
            SDCycleScrollView * scrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREENWIDTH, 150) imageURLStringsGroup:self.topScrollPicArr];
            [_scrollImg addSubview:scrollView];
//            [_rankBut setBackgroundImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:0] picUrl]]]] forState:UIControlStateNormal];
            UIImageView *rangImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 30, 30)];
            [rangImg sd_setImageWithURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:0] picUrl]] placeholderImage:nil];
            [_rankBut addSubview:rangImg];
//            [_songMenuBut setBackgroundImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:1] picUrl]]]] forState:UIControlStateNormal];
            UIImageView *songImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 30, 30)];
            [songImg sd_setImageWithURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:1] picUrl]] placeholderImage:nil];
            [_songMenuBut addSubview:songImg];
//            [_videoBut setBackgroundImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:2] picUrl]]]] forState:UIControlStateNormal];
            UIImageView *videoImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 30, 30)];
            [videoImg sd_setImageWithURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:2] picUrl]] placeholderImage:nil];
            [_videoBut addSubview:videoImg];
//            [_singerBut setBackgroundImage:[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:3] picUrl]]]] forState:UIControlStateNormal];
            UIImageView *singerImg = [[UIImageView alloc] initWithFrame:CGRectMake(10, 0, 30, 30)];
            [singerImg sd_setImageWithURL:[NSURL URLWithString:[[_buttonArr objectAtIndex:3] picUrl]] placeholderImage:nil];
            [_singerBut addSubview:singerImg];
            [_rankBut setTitle:[[_buttonArr objectAtIndex:0] name] forState:0];
            [_rankBut setTitleColor:[UIColor blackColor] forState:0];
//            _rankBut.layer.cornerRadius = 25;
//            _rankBut.clipsToBounds = YES;
            _rankBut.titleLabel.font = [UIFont systemFontOfSize:15];//title字体大小
             _rankBut.titleLabel.textAlignment = NSTextAlignmentCenter;//设置title的字体居中
            _rankBut.titleEdgeInsets = UIEdgeInsetsMake(20, -_rankBut.titleLabel.bounds.size.width , -10, 0);//设置title在button上的位置（上top，左left，下bottom，右right）
            [_songMenuBut setTitle:[[_buttonArr objectAtIndex:1] name] forState:0];
            [_songMenuBut setTitleColor:[UIColor blackColor] forState:0];
//            _songMenuBut.layer.cornerRadius = 25;
//            _songMenuBut.clipsToBounds = YES;
            _songMenuBut.titleLabel.font = [UIFont systemFontOfSize:15];//title字体大小
            _songMenuBut.titleLabel.textAlignment = NSTextAlignmentCenter;//设置title的字体居中
            _songMenuBut.titleEdgeInsets =  UIEdgeInsetsMake(20, -_songMenuBut.titleLabel.bounds.size.width , -10, 0);
            [_videoBut setTitle:[[_buttonArr objectAtIndex:2] name] forState:0];
            [_videoBut setTitleColor:[UIColor blackColor] forState:0];
//            _videoBut.layer.cornerRadius = 25;
//            _videoBut.clipsToBounds = YES;
            _videoBut.titleLabel.font = [UIFont systemFontOfSize:15];//title字体大小
            _videoBut.titleLabel.textAlignment = NSTextAlignmentCenter;//设置title的字体居中
            _videoBut.titleEdgeInsets = _songMenuBut.titleEdgeInsets;//UIEdgeInsetsMake(20, -_rankBut.titleLabel.bounds.size.width , 0, 0);
            [_singerBut setTitle:[[_buttonArr objectAtIndex:3] name] forState:0];
            [_singerBut setTitleColor:[UIColor blackColor] forState:0];
//            _singerBut.layer.cornerRadius = 25;
//            _singerBut.clipsToBounds = YES;
            _singerBut.titleLabel.font = [UIFont systemFontOfSize:15];//title字体大小
            _singerBut.titleLabel.textAlignment = NSTextAlignmentCenter;//设置title的字体居中
            _singerBut.titleEdgeInsets = _videoBut.titleEdgeInsets; //UIEdgeInsetsMake(20, -_rankBut.titleLabel.bounds.size.width , 0, 0);
//            _songMenuBut.backgroundColor = [UIColor colorWithWhite:255.0 alpha:1];
        }
    }];

}
#pragma mark - header高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return 30;
//    } else if (section == 1) {
//        return 30;
//    } else if (section == 2) {
//        return 30;
    }
    
    return 30;
}
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
     if (self.asiaRowArr.count > 0 && self.musicRowArr.count > 0 && self.eveyTenRowArr.count > 0) {
         
    if (section == 0) {
        UIView *hotV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 30)];
        UILabel *hot = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, SCREENWIDTH - 70, 20)];
        UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
//        but.backgroundColor = [UIColor redColor];
        but.frame = CGRectMake(SCREENWIDTH - 60, 5, 50, 20);
        [but setTitle:@"更多" forState:0];
        but.tag = 1010;
        [but setTitleColor:[UIColor blackColor] forState:0];
        [but addTarget:self action:@selector(ButtonAction:) forControlEvents:UIControlEventTouchUpInside];
        [hotV addSubview:but];
        hot.text = self.homeTitleArr[3];
        [hotV addSubview:hot];
        return hotV;
    } else if (section == 1) {
        UIView *fimeV = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 30)];
        UILabel * fime = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, SCREENWIDTH - 10, 20)];
    
//        NSLog(@"~~~~~~~~~~~~~~~~~%@",self.homeTitleArr[6]);
        fime.text = self.homeTitleArr[6];
        [fimeV addSubview:fime];
        return fimeV;
    } else if (section == 2){
        UIView *vv = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 30)];
        UILabel *songRang = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, SCREENWIDTH - 10, 20)];
        songRang.text = self.homeTitleArr[9];
        [vv addSubview:songRang];
        return vv;
    } else if (section == 3){
        UIView *vv = [[UIView alloc]initWithFrame:CGRectMake(0, 0, SCREENWIDTH, 30)];
        UILabel *songRang = [[UILabel alloc] initWithFrame:CGRectMake(10, 5, SCREENWIDTH - 10, 20)];
        UIButton *but = [UIButton buttonWithType:UIButtonTypeCustom];
        //        but.backgroundColor = [UIColor redColor];
        but.frame = CGRectMake(SCREENWIDTH - 60, 5, 50, 20);
        [but setTitle:@"更多" forState:0];
        but.tag = 1020;
        [but setTitleColor:[UIColor blackColor] forState:0];
        [but addTarget:self action:@selector(ButtonAction:) forControlEvents:UIControlEventTouchUpInside];
        [vv addSubview:but];
        songRang.text = self.homeTitleArr[10];
        [vv addSubview:songRang];
        return vv;
    }
     } else {}
    UIView *v =[[UIView alloc] initWithFrame:CGRectZero];
    return v;
     
    
}
- (void)ButtonAction:(UIButton *)sender
{
    if (sender.tag == 1010) {
        GCW_SongMuneViewController *songVC = [[GCW_SongMuneViewController alloc] init];
        [self.navigationController pushViewController:songVC animated:YES];
        
    } else if (sender.tag == 1020){
        
        // 点击更多button 进入音乐专题页面
        LTY_MusicProjectViewController *MusicProjectVC = [[LTY_MusicProjectViewController alloc] init];
        [self.navigationController pushViewController:MusicProjectVC animated:YES];
        
    }
}
#pragma mark - 区数
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 4;
}
#pragma mark - 每区行数
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
//    if (self.asiaRowArr.count > 0 && self.musicRowArr.count > 0 && self.eveyTenRowArr.count > 0) {

    if (section == 0) {
        return 1;
    } else if (section == 1) {
        return self.asiaRowArr.count;
    } else if (section == 2 ){
        return self.eveyTenRowArr.count;
    
    } else {
        return self.musicRowArr.count;
    }
//    }
//    return 0;
}
#pragma mark - 行高
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.section == 0) {
        return SCREENHEIGHT / 4.5 * 3 + 70;
    } else {
        return 110;
    }
    
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    
   
    if (indexPath.section == 0) {
   
    WJY_HomeScondCell *cell = [tableView dequeueReusableCellWithIdentifier:@"firstCell"];
        
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
        
        void(^block)(NSInteger) = ^(NSInteger i) {
            // 废弃了
            // 进入每日十首页面
//            LTY_FilmAndSongsViewController *FilmAndSongsVC = [[LTY_FilmAndSongsViewController alloc] init];
//            [self.navigationController pushViewController:FilmAndSongsVC  animated:YES];
        } ;
        cell.block = block;
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
        
    } else if (indexPath.section == 1) {
        WJY_SongRankCell *cell = [tableView dequeueReusableCellWithIdentifier:@"asiaCell"];
        [cell.img sd_setImageWithURL:[NSURL URLWithString:[self.asiaRowArr[indexPath.row] picUrl]] placeholderImage:[UIImage imageNamed:@"mv_big_cover_default.jpg"]];
        cell.titelName.text = [self.asiaRowArr[indexPath.row] name];
        cell.subName.text = [self.asiaRowArr[indexPath.row] desc];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    } else if (indexPath.section == 2) {
        WJY_TenSongEveryDayCell *cell = [tableView dequeueReusableCellWithIdentifier:@"tenCell"];
        [cell.img sd_setImageWithURL:[NSURL URLWithString:[self.eveyTenRowArr[indexPath.row] picUrl]] placeholderImage:[UIImage imageNamed:@"mv_big_cover_default.jpg"]];
        cell.contTitle.text = [self.eveyTenRowArr[indexPath.row] desc];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    } /*else if (indexPath.section == 3) {
        WJY_FilmeSongTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"filmCell"];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }*/ else {
        WJY_SongRankCell *cell = [tableView dequeueReusableCellWithIdentifier:@"rankCell"];
        [cell.img sd_setImageWithURL:[NSURL URLWithString:[self.musicRowArr[indexPath.row] picUrl]] placeholderImage:[UIImage imageNamed:@"mv_big_cover_default.jpg"]];
        cell.titelName.text = [self.musicRowArr[indexPath.row] name];
        cell.subName.text = [self.musicRowArr[indexPath.row] desc];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        return cell;
    }
    
}


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
    
    if (indexPath.section == 1) {
        // 进入亚洲新歌榜的页面
        // 版本判断 wkwebview不支持8.0以下的
        if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0f) {
            LTY_WKWebViewController *WKWebVC = [[LTY_WKWebViewController alloc] init];
            WKWebVC.WkwebString = @"http://www.xiami.com/market/music/act/asia-song.php";
            WKWebVC.title = @"亚洲新歌榜";
            [self.navigationController pushViewController:WKWebVC animated:YES];
        }else{
            
            LTY_WebViewController *WebVC = [[LTY_WebViewController alloc] init];
            WebVC.webString = @"http://www.xiami.com/market/music/act/asia-song.php";
            WebVC.title = @"亚洲新歌榜";
            [self.navigationController pushViewController:WebVC animated:YES];
            
        }

    }
    
    if (indexPath.section == 2) {
        // 进入每日十首页面
        LTY_FilmAndSongsViewController *FilmAndSongsVC = [[LTY_FilmAndSongsViewController alloc] init];
        // 把每日十首接口传递过去
        FilmAndSongsVC.DayString = @"http://api.songlist.ttpod.com/songlists/304599956?app=ttpod&v=v8.0.1.2015091618";
        [self.navigationController pushViewController:FilmAndSongsVC animated:YES];

    }
    
    if (indexPath.section == 3) {
        LTY_WebViewController *webVC = [[LTY_WebViewController alloc] init];
        NSString *webString = [self.musicValArr objectAtIndex:indexPath.row];
        webVC.webString = webString;
        [self.navigationController pushViewController:webVC animated:YES];

    }
    
}
// 去掉UItableview headerview黏性(sticky)
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGFloat sectionHeaderHeight = 30;
    if (scrollView.contentOffset.y <=sectionHeaderHeight&&scrollView.contentOffset.y >= 0) {
        scrollView.contentInset = UIEdgeInsetsMake(-scrollView.contentOffset.y, 0, 0, 0);
    }
    else if (scrollView.contentOffset.y >= sectionHeaderHeight) {
        scrollView.contentInset = UIEdgeInsetsMake(-sectionHeaderHeight, 0, 0, 0);
    }
}


#pragma mark -- 夜间模式
- (void)setNightDayModel {
    [NightManager setBackgroundColorWithView:self.view];
    
    
}

- (void)setLightDayModel {
    [NightManager setBackgroundColorWithView:self.view];
    
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
